<?php
/**
 * Created by PhpStorm.
 * User: FDG296
 * Date: 2017/8/2
 * Time: 16:42
 */
namespace common\models;

use Yii;
use yii\db\ActiveRecord;

class CustMasterFirstLog extends ActiveRecord{

    public static function tableName(){
        return '{{%cust_master_first_log}}';
    }

	/**
	 * @inheritdoc
	 */
	public function rules()
	{
		return [
			[['member_no','mobile'], 'safe'],

		];
	}

	public function beforeSave($insert){
		$this->create_time = date('Y-m-d h:i:s');
		return parent::beforeSave($insert);
	}

	public function getCustMasterLog(){
		return self::find()
			->where(['mobile'=>$this->mobile])
			->one();
	}
}